<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var obj = {
      uname: 'zw',
      age: 18, 
      sayHi: function() {  // 函数 方法
        console.log('hello111')

        return 123
      },
      arr: [1, 2, 3],
      address: {
        city: '成都',
        id: 1020
      }
    }

    console.log( obj.sayHi() )
    console.log( obj['sayHi']() )

    // obj.sayHi()
    // obj['sayHi']()

    // console.log( obj.age )
    // console.log( obj.uname )
    // console.log( obj.arr )

    // var test = 'qwe'

    // console.log( obj['uname'] )  // 中括号的值需要加 引号
    // console.log( obj[test] )  //  如果不加引号， 那就当成变量访问了 
    // console.log( obj['array'] )

  </script>
</body>
</html>